package cn.afterturn.easypoi.reference;

import cn.afterturn.easypoi.entity.ImageEntity;
import cn.afterturn.easypoi.word.entity.params.ExcelListEntity;
import org.apache.poi.xwpf.usermodel.XWPFDocument;

import java.io.FileOutputStream;
import java.text.SimpleDateFormat;
import java.util.*;

public class wordTest {
    private static SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd");
    public static void main(String[] args) {
        wordTest();
    }
    public static void wordTest() {
        Map<String, Object> map = new HashMap<String, Object>();
        //map.put("qingdanfile", "Easypoi");
        map.put("q 张锡纯 ingdanfile", "Easypoi");

        map.put("收文日期", format.format(new Date()));
        map.put("代理组织", "JueYue");
        map.put("生成日期", format.format(new Date()));
        map.put("公司名称", "zzf");
        ImageEntity image = new ImageEntity();
        image.setHeight(200);
        image.setWidth(500);
        image.setUrl("d:/testCode.png");
        image.setType(ImageEntity.URL);
        map.put("testCode", image);
        //map.put("testCode", "zzf");
        map.put("项目ER关系图", "zzf1");
        map.put("院负责人", "sjk");

        List<PersonBysteven> list = new ArrayList<PersonBysteven>();
        PersonBysteven p1 = new PersonBysteven();
        p1.setName("孙精科");
        /*p1.setTel("18711111111");
        p.setEmail("18711111111@139.com");*/
        p1.setCountry("中国");
        list.add(p1);
        PersonBysteven p2 = new PersonBysteven();
        p2.setName("alex");
       /* p.setTel("18711111112");
        p.setEmail("18711111112@139.com");*/
        p2.setCountry("巴西");
        list.add(p2);
        map.put("pList", new ExcelListEntity(list, PersonBysteven.class));
        try {
            String fileName="d://t清单文件Normal.docx";
           /* XWPFDocument doc = WordExportUtil.exportWord07(
                    fileName, map);
            FileOutputStream fos = new FileOutputStream("D://Together.docx");
            doc.write(fos);
            fos.close();*/
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
